﻿namespace NetSync.Test
{
    public class MessageInfo<TBody> : MessageBase
    {
        public TBody Body {  get; set; }
    }

    public class MessageRepInfo<TData> : MessageBase
    {
        public RepBody<TData> Body { get; set; }
    }

    public class MessageBase
    {
        public MessageHeader Header { get; set; }
    }

    public class MessageHeader
    {
        /// <summary>
        /// 唯一ID
        /// </summary>
        public string TransactionId {  get; set; }

        /// <summary>
        /// 请求或回复
        /// </summary>
        public DirectionTypeEnum Direction { get; set; }

        /// <summary>
        /// 设备编码
        /// </summary>
        public string EqpCode {  get; set; }
    }

    public class RepBody
    {
        /// <summary>
        /// 非0为异常
        /// </summary>
        public int Code {  get; set; }

        /// <summary>
        /// 异常信息
        /// </summary>
        public string Msg { get; set; }
    }

    public class RepBody<TData> : RepBody
    {
        public TData Data { get; set; }
    }

    public enum DirectionTypeEnum
    {
        Request = 1,

        Response = 2,
    }
}
